package org.skyeye.modeling.policies;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.ComponentEditPolicy;
import org.eclipse.gef.requests.GroupRequest;
import org.skyeye.modeling.commands.DeleteConnectionCommand;
import org.skyeye.modeling.model.MConnection;

public class ConnectionEditPolicy extends ComponentEditPolicy {

	protected Command createDeleteCommand(GroupRequest deleteRequest) {
		MConnection conn = (MConnection) getHost().getModel();
		DeleteConnectionCommand cmd = new DeleteConnectionCommand();
		cmd.setConnection(conn);
		cmd.setSource(conn.getSource());
		cmd.setTarget(conn.getSink());
		return cmd;
	}
}
